﻿namespace Emmajn.ChildParentExtension.BusinessApplication
{
    using System;
    using System.ComponentModel.DataAnnotations;
    using System.ServiceModel.DomainServices.Client;
    using System.ServiceModel.DomainServices.Client.ApplicationServices;
    using Emmajn.ChildParentExtension.BusinessApplication.Web.Resources;

    public enum Relationship
    {
        Mother,
        Father,
        [Display(Name = "Foster mother")]
        FosterMother,
        [Display(Name = "Foster father")]
        FosterFather,
        Other
    }

    /// <summary>
    /// This internal entity is used to ease the binding between the UI controls
    /// (DataForm and the label displaying a validation error) and the log on
    /// credentials entered by the user.
    /// </summary>
    public class InpatientInfo : Entity
    {
        private string patientFirstName;
        private string patientMiddleInitial;
        private string patientLastName;
        private string patientSuffix;
        private string patientNumber;
        private string firstParentOrGuardianFirstName;
        private string firstParentOrGuardianMiddleInitial;
        private string firstParentOrGuardianLastName;
        private string firstParentOrGuardianSuffix;
        private Relationship firstParentOrGuardianRelationship;
        private string firstParentOrGuardianFirstLineOfHomeAddress;
        private string firstParentOrGuardianSecondLineOfHomeAddress;
        private string firstParentOrGuardianHomeCity;
        private string firstParentOrGuardianHomeStateProvinceOrRegion;
        private string firstParentOrGuardianHomePostalCode;
        private string firstParentOrGuardianHomeCountry;
        private string firstParentOrGuardianFirstLineOfLocalAddress;
        private string firstParentOrGuardianSecondLineOfLocalAddress;
        private string firstParentOrGuardianLocalCity;
        private string firstParentOrGuardianLocalStateProvinceOrRegion;
        private string firstParentOrGuardianLocalPostalCode;
        private string firstParentOrGuardianLocalCountry;
        private string firstParentOrGuardianHomeTelephoneNumber;
        private string firstParentOrGuardianLocalTelephoneNumber;
        private string secondParentOrGuardianFirstName;
        private string secondParentOrGuardianMiddleInitial;
        private string secondParentOrGuardianLastName;
        private string secondParentOrGuardianSuffix;
        private Relationship secondParentOrGuardianRelationship;
        private string secondParentOrGuardianFirstLineOfHomeAddress;
        private string secondParentOrGuardianSecondLineOfHomeAddress;
        private string secondParentOrGuardianHomeCity;
        private string secondParentOrGuardianHomeStateProvinceOrRegion;
        private string secondParentOrGuardianHomePostalCode;
        private string secondParentOrGuardianHomeCountry;
        private string secondParentOrGuardianFirstLineOfLocalAddress;
        private string secondParentOrGuardianSecondLineOfLocalAddress;
        private string secondParentOrGuardianLocalCity;
        private string secondParentOrGuardianLocalStateProvinceOrRegion;
        private string secondParentOrGuardianLocalPostalCode;
        private string secondParentOrGuardianLocalCountry;
        private string secondParentOrGuardianHomeTelephoneNumber;
        private string secondParentOrGuardianLocalTelephoneNumber;
        private string patientLocation;
        private string primaryPhysicianFirstName;
        private string primaryPhysicianMiddleInitial;
        private string primaryPhysicianLastName;
        private string primaryPhysicianSuffix;
        private string primaryPhysicianHospitalBeeperNumber;
        private string primaryNurseFirstName;
        private string primaryNurseMiddleInitial;
        private string primaryNurseLastName;
        private string primaryNurseSuffix;
        private string primaryNurseHospitalBeeperNumber;
        private DateTime dateAdmitted = DateTime.Today;
        private DateTime dateDischarged = DateTime.MaxValue.Date;
        private bool withinMileLimit;
        private bool jcfAssistance;
        private bool wfAssistance;
        private bool jcAssistance;

        /// <summary>
        /// Gets and sets the first name.
        /// </summary>
        [Required]
        [Display(Name = "Patient first name")]
        [StringLength(15)]
        public string PatientFirstName
        {
            get
            {
                return this.patientFirstName;
            }

            set
            {
                if (this.patientFirstName != value)
                {
                    this.ValidateProperty("PatientFirstName", value);
                    this.patientFirstName = value;
                    this.RaisePropertyChanged("PatientFirstName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the middle initial.
        /// </summary>
        [Display(Name = "Patient middle initial")]
        [StringLength(1)]
        public string PatientMiddleInitial
        {
            get
            {
                return this.patientMiddleInitial;
            }

            set
            {
                if (this.patientMiddleInitial != value)
                {
                    this.ValidateProperty("PatientMiddleInitial", value);
                    this.patientMiddleInitial = value;
                    this.RaisePropertyChanged("PatientMiddleInitial");
                }
            }
        }

        /// <summary>
        /// Gets and sets the last name.
        /// </summary>
        [Required]
        [Display(Name = "Patient last name")]
        [StringLength(15)]
        public string PatientLastName
        {
            get
            {
                return this.patientLastName;
            }

            set
            {
                if (this.patientLastName != value)
                {
                    this.ValidateProperty("PatientLastName", value);
                    this.patientLastName = value;
                    this.RaisePropertyChanged("PatientLastName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Patient suffix")]
        [StringLength(5)]
        public string PatientSuffix
        {
            get
            {
                return this.patientSuffix;
            }

            set
            {
                if (this.patientSuffix != value)
                {
                    this.ValidateProperty("PatientSuffix", value);
                    this.patientSuffix = value;
                    this.RaisePropertyChanged("PatientSuffix");
                }
            }
        }

        /// <summary>
        /// Gets and sets the number.
        /// </summary>
        [Required]
        [RegularExpression(@"^\d{3}-\d{2}-\d{4}$")]
        [Display(Name="Patient number", Description = "NNN-NN-NNNN")]
        public string PatientNumber
        {
            get
            {
                return this.patientNumber;
            }

            set
            {
                if (this.patientNumber != value)
                {
                    this.ValidateProperty("PatientNumber", value);
                    this.patientNumber = value;
                    this.RaisePropertyChanged("PatientNumber");
                }
            }
        }

        /// <summary>
        /// Gets and sets the first name.
        /// </summary>
        [Required]
        [Display(Name = "Patient parent or guardian 1: First name")]
        [StringLength(15)]
        public string FirstParentOrGuardianFirstName
        {
            get
            {
                return this.firstParentOrGuardianFirstName;
            }

            set
            {
                if (this.firstParentOrGuardianFirstName != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianFirstName", value);
                    this.firstParentOrGuardianFirstName = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianFirstName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the middle initial.
        /// </summary>
        [Display(Name = "Patient parent or guardian 1: Middle initial")]
        [StringLength(1)]
        public string FirstParentOrGuardianMiddleInitial
        {
            get
            {
                return this.firstParentOrGuardianMiddleInitial;
            }

            set
            {
                if (this.firstParentOrGuardianMiddleInitial != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianMiddleInitial", value);
                    this.firstParentOrGuardianMiddleInitial = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianMiddleInitial");
                }
            }
        }

        /// <summary>
        /// Gets and sets the last name.
        /// </summary>
        [Required]
        [Display(Name = "Patient parent or guardian 1: Last name")]
        [StringLength(15)]
        public string FirstParentOrGuardianLastName
        {
            get
            {
                return this.firstParentOrGuardianLastName;
            }

            set
            {
                if (this.firstParentOrGuardianLastName != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianLastName", value);
                    this.firstParentOrGuardianLastName = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianLastName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Patient parent or guardian 1: Suffix")]
        [StringLength(5)]
        public string FirstParentOrGuardianSuffix
        {
            get
            {
                return this.firstParentOrGuardianSuffix;
            }

            set
            {
                if (this.firstParentOrGuardianSuffix != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianSuffix", value);
                    this.firstParentOrGuardianSuffix = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianSuffix");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Relationship to patient")]
        [EnumDataType(typeof(Relationship))]
        [Required]
        public Relationship FirstParentOrGuardianRelationship
        {
            get
            {
                return this.firstParentOrGuardianRelationship;
            }

            set
            {
                if (this.firstParentOrGuardianRelationship != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianRelationship", value);
                    this.firstParentOrGuardianRelationship = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianRelationship");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: First line of home address")]
        [Required]
        [StringLength(25)]
        public string FirstParentOrGuardianFirstLineOfHomeAddress
        {
            get
            {
                return this.firstParentOrGuardianFirstLineOfHomeAddress;
            }

            set
            {
                if (this.firstParentOrGuardianFirstLineOfHomeAddress != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianFirstLineOfHomeAddress", value);
                    this.firstParentOrGuardianFirstLineOfHomeAddress = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianFirstLineOfHomeAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Second line of home address")]
        [StringLength(25)]
        public string FirstParentOrGuardianSecondLineOfHomeAddress
        {
            get
            {
                return this.firstParentOrGuardianSecondLineOfHomeAddress;
            }

            set
            {
                if (this.firstParentOrGuardianSecondLineOfHomeAddress != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianSecondLineOfHomeAddress", value);
                    this.firstParentOrGuardianSecondLineOfHomeAddress = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianSecondLineOfHomeAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Home city")]
        [Required]
        [StringLength(14)]
        public string FirstParentOrGuardianHomeCity
        {
            get
            {
                return this.firstParentOrGuardianHomeCity;
            }

            set
            {
                if (this.firstParentOrGuardianHomeCity != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianHomeCity", value);
                    this.firstParentOrGuardianHomeCity = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianHomeCity");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Home state, province, or region")]
        [Required]
        [StringLength(14)]
        public string FirstParentOrGuardianHomeStateProvinceOrRegion
        {
            get
            {
                return this.firstParentOrGuardianHomeStateProvinceOrRegion;
            }

            set
            {
                if (this.firstParentOrGuardianHomeStateProvinceOrRegion != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianHomeStateProvinceOrRegion", value);
                    this.firstParentOrGuardianHomeStateProvinceOrRegion = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianHomeStateProvinceOrRegion");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Home postal code")]
        [StringLength(10)]
        [RegularExpression(@"^[\w\d-\s]*$")]
        public string FirstParentOrGuardianHomePostalCode
        {
            get
            {
                return this.firstParentOrGuardianHomePostalCode;
            }

            set
            {
                if (this.firstParentOrGuardianHomePostalCode != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianHomePostalCode", value);
                    this.firstParentOrGuardianHomePostalCode = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianHomePostalCode");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Home country")]
        [Required]
        [StringLength(20)]
        public string FirstParentOrGuardianHomeCountry
        {
            get
            {
                return this.firstParentOrGuardianHomeCountry;
            }

            set
            {
                if (this.firstParentOrGuardianHomeCountry != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianHomeCountry", value);
                    this.firstParentOrGuardianHomeCountry = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianHomeCountry");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: First line of local address")]
        
        [StringLength(25)]
        public string FirstParentOrGuardianFirstLineOfLocalAddress
        {
            get
            {
                return this.firstParentOrGuardianFirstLineOfLocalAddress;
            }

            set
            {
                if (this.firstParentOrGuardianFirstLineOfLocalAddress != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianFirstLineOfLocalAddress", value);
                    this.firstParentOrGuardianFirstLineOfLocalAddress = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianFirstLineOfLocalAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Second line of local address")]
        [StringLength(25)]
        public string FirstParentOrGuardianSecondLineOfLocalAddress
        {
            get
            {
                return this.firstParentOrGuardianSecondLineOfLocalAddress;
            }

            set
            {
                if (this.firstParentOrGuardianSecondLineOfLocalAddress != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianSecondLineOfLocalAddress", value);
                    this.firstParentOrGuardianSecondLineOfLocalAddress = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianSecondLineOfLocalAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Local city")]
        
        [StringLength(14)]
        public string FirstParentOrGuardianLocalCity
        {
            get
            {
                return this.firstParentOrGuardianLocalCity;
            }

            set
            {
                if (this.firstParentOrGuardianLocalCity != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianLocalCity", value);
                    this.firstParentOrGuardianLocalCity = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianLocalCity");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Local state, province, or region")]
        
        [StringLength(14)]
        public string FirstParentOrGuardianLocalStateProvinceOrRegion
        {
            get
            {
                return this.firstParentOrGuardianLocalStateProvinceOrRegion;
            }

            set
            {
                if (this.firstParentOrGuardianLocalStateProvinceOrRegion != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianLocalStateProvinceOrRegion", value);
                    this.firstParentOrGuardianLocalStateProvinceOrRegion = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianLocalStateProvinceOrRegion");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Local postal code")]
        [StringLength(10)]
        [RegularExpression(@"^[\w\d-\s]*$")]
        public string FirstParentOrGuardianLocalPostalCode
        {
            get
            {
                return this.firstParentOrGuardianLocalPostalCode;
            }

            set
            {
                if (this.firstParentOrGuardianLocalPostalCode != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianLocalPostalCode", value);
                    this.firstParentOrGuardianLocalPostalCode = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianLocalPostalCode");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Local country")]
        [StringLength(20)]
        public string FirstParentOrGuardianLocalCountry
        {
            get
            {
                return this.firstParentOrGuardianLocalCountry;
            }

            set
            {
                if (this.firstParentOrGuardianLocalCountry != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianLocalCountry", value);
                    this.firstParentOrGuardianLocalCountry = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianLocalCountry");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Home telphone number")]
        [Required]
        [RegularExpression(@"^(\+(\d{0,3})-)?(\d{0,3})-(\d{0,4})-(\d{0,4})( Ext (\d{0,6}))?$")]
        public string FirstParentOrGuardianHomeTelephoneNumber
        {
            get
            {
                return this.firstParentOrGuardianHomeTelephoneNumber;
            }

            set
            {
                if (this.firstParentOrGuardianHomeTelephoneNumber != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianHomeTelephoneNumber", value);
                    this.firstParentOrGuardianHomeTelephoneNumber = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianHomeTelephoneNumber");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 1: Local telphone number")]
        [RegularExpression(@"^(\+(\d{0,3})-)?(\d{0,3})-(\d{0,4})-(\d{0,4})( Ext (\d{0,6}))?$")]
        public string FirstParentOrGuardianLocalTelephoneNumber
        {
            get
            {
                return this.firstParentOrGuardianLocalTelephoneNumber;
            }

            set
            {
                if (this.firstParentOrGuardianLocalTelephoneNumber != value)
                {
                    this.ValidateProperty("FirstParentOrGuardianLocalTelephoneNumber", value);
                    this.firstParentOrGuardianLocalTelephoneNumber = value;
                    this.RaisePropertyChanged("FirstParentOrGuardianLocalTelephoneNumber");
                }
            }
        }

        /// <summary>
        /// Gets and sets the first name.
        /// </summary>
        
        [Display(Name = "Patient parent or guardian 2: First name")]
        [StringLength(15)]
        public string SecondParentOrGuardianFirstName
        {
            get
            {
                return this.secondParentOrGuardianFirstName;
            }

            set
            {
                if (this.secondParentOrGuardianFirstName != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianFirstName", value);
                    this.secondParentOrGuardianFirstName = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianFirstName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the middle initial.
        /// </summary>
        [Display(Name = "Patient parent or guardian 2: Middle initial")]
        [StringLength(1)]
        public string SecondParentOrGuardianMiddleInitial
        {
            get
            {
                return this.secondParentOrGuardianMiddleInitial;
            }

            set
            {
                if (this.secondParentOrGuardianMiddleInitial != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianMiddleInitial", value);
                    this.secondParentOrGuardianMiddleInitial = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianMiddleInitial");
                }
            }
        }

        /// <summary>
        /// Gets and sets the last name.
        /// </summary>
        
        [Display(Name = "Patient parent or guardian 2: Last name")]
        [StringLength(15)]
        public string SecondParentOrGuardianLastName
        {
            get
            {
                return this.secondParentOrGuardianLastName;
            }

            set
            {
                if (this.secondParentOrGuardianLastName != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianLastName", value);
                    this.secondParentOrGuardianLastName = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianLastName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Patient parent or guardian 2: Suffix")]
        [StringLength(5)]
        public string SecondParentOrGuardianSuffix
        {
            get
            {
                return this.secondParentOrGuardianSuffix;
            }

            set
            {
                if (this.secondParentOrGuardianSuffix != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianSuffix", value);
                    this.secondParentOrGuardianSuffix = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianSuffix");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Relationship to patient")]
        [EnumDataType(typeof(Relationship))]
        
        public Relationship SecondParentOrGuardianRelationship
        {
            get
            {
                return this.secondParentOrGuardianRelationship;
            }

            set
            {
                if (this.secondParentOrGuardianRelationship != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianRelationship", value);
                    this.secondParentOrGuardianRelationship = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianRelationship");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: First line of home address")]
        
        [StringLength(25)]
        public string SecondParentOrGuardianFirstLineOfHomeAddress
        {
            get
            {
                return this.secondParentOrGuardianFirstLineOfHomeAddress;
            }

            set
            {
                if (this.secondParentOrGuardianFirstLineOfHomeAddress != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianFirstLineOfHomeAddress", value);
                    this.secondParentOrGuardianFirstLineOfHomeAddress = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianFirstLineOfHomeAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Second line of home address")]
        [StringLength(25)]
        public string SecondParentOrGuardianSecondLineOfHomeAddress
        {
            get
            {
                return this.secondParentOrGuardianSecondLineOfHomeAddress;
            }

            set
            {
                if (this.secondParentOrGuardianSecondLineOfHomeAddress != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianSecondLineOfHomeAddress", value);
                    this.secondParentOrGuardianSecondLineOfHomeAddress = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianSecondLineOfHomeAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Home city")]
        
        [StringLength(14)]
        public string SecondParentOrGuardianHomeCity
        {
            get
            {
                return this.secondParentOrGuardianHomeCity;
            }

            set
            {
                if (this.secondParentOrGuardianHomeCity != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianHomeCity", value);
                    this.secondParentOrGuardianHomeCity = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianHomeCity");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Home state, province, or region")]
        
        [StringLength(14)]
        public string SecondParentOrGuardianHomeStateProvinceOrRegion
        {
            get
            {
                return this.secondParentOrGuardianHomeStateProvinceOrRegion;
            }

            set
            {
                if (this.secondParentOrGuardianHomeStateProvinceOrRegion != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianHomeStateProvinceOrRegion", value);
                    this.secondParentOrGuardianHomeStateProvinceOrRegion = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianHomeStateProvinceOrRegion");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Home postal code")]
        [StringLength(10)]
        [RegularExpression(@"^[\w\d-\s]*$")]
        public string SecondParentOrGuardianHomePostalCode
        {
            get
            {
                return this.secondParentOrGuardianHomePostalCode;
            }

            set
            {
                if (this.secondParentOrGuardianHomePostalCode != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianHomePostalCode", value);
                    this.secondParentOrGuardianHomePostalCode = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianHomePostalCode");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Home country")]
        [StringLength(20)]
        public string SecondParentOrGuardianHomeCountry
        {
            get
            {
                return this.secondParentOrGuardianHomeCountry;
            }

            set
            {
                if (this.secondParentOrGuardianHomeCountry != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianHomeCountry", value);
                    this.secondParentOrGuardianHomeCountry = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianHomeCountry");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: First line of local address")]

        [StringLength(25)]
        public string SecondParentOrGuardianFirstLineOfLocalAddress
        {
            get
            {
                return this.secondParentOrGuardianFirstLineOfLocalAddress;
            }

            set
            {
                if (this.secondParentOrGuardianFirstLineOfLocalAddress != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianFirstLineOfLocalAddress", value);
                    this.secondParentOrGuardianFirstLineOfLocalAddress = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianFirstLineOfLocalAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Second line of local address")]
        [StringLength(25)]
        public string SecondParentOrGuardianSecondLineOfLocalAddress
        {
            get
            {
                return this.secondParentOrGuardianSecondLineOfLocalAddress;
            }

            set
            {
                if (this.secondParentOrGuardianSecondLineOfLocalAddress != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianSecondLineOfLocalAddress", value);
                    this.secondParentOrGuardianSecondLineOfLocalAddress = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianSecondLineOfLocalAddress");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Local city")]

        [StringLength(14)]
        public string SecondParentOrGuardianLocalCity
        {
            get
            {
                return this.secondParentOrGuardianLocalCity;
            }

            set
            {
                if (this.secondParentOrGuardianLocalCity != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianLocalCity", value);
                    this.secondParentOrGuardianLocalCity = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianLocalCity");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Local state, province, or region")]

        [StringLength(14)]
        public string SecondParentOrGuardianLocalStateProvinceOrRegion
        {
            get
            {
                return this.secondParentOrGuardianLocalStateProvinceOrRegion;
            }

            set
            {
                if (this.secondParentOrGuardianLocalStateProvinceOrRegion != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianLocalStateProvinceOrRegion", value);
                    this.secondParentOrGuardianLocalStateProvinceOrRegion = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianLocalStateProvinceOrRegion");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Local postal code")]
        [StringLength(10)]
        [RegularExpression(@"^[\w\d-\s]*$")]
        public string SecondParentOrGuardianLocalPostalCode
        {
            get
            {
                return this.secondParentOrGuardianLocalPostalCode;
            }

            set
            {
                if (this.secondParentOrGuardianLocalPostalCode != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianLocalPostalCode", value);
                    this.secondParentOrGuardianLocalPostalCode = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianLocalPostalCode");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Local country")]
        [StringLength(20)]
        public string SecondParentOrGuardianLocalCountry
        {
            get
            {
                return this.secondParentOrGuardianLocalCountry;
            }

            set
            {
                if (this.secondParentOrGuardianLocalCountry != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianLocalCountry", value);
                    this.secondParentOrGuardianLocalCountry = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianLocalCountry");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Home telphone number")]
        
        [RegularExpression(@"^(\+(\d{0,3})-)?(\d{0,3})-(\d{0,4})-(\d{0,4})( Ext (\d{0,6}))?$")]
        public string SecondParentOrGuardianHomeTelephoneNumber
        {
            get
            {
                return this.secondParentOrGuardianHomeTelephoneNumber;
            }

            set
            {
                if (this.secondParentOrGuardianHomeTelephoneNumber != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianHomeTelephoneNumber", value);
                    this.secondParentOrGuardianHomeTelephoneNumber = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianHomeTelephoneNumber");
                }
            }
        }

        [Display(Name = "Patient parent or guardian 2: Local telphone number")]
        [RegularExpression(@"^(\+(\d{0,3})-)?(\d{0,3})-(\d{0,4})-(\d{0,4})( Ext (\d{0,6}))?$")]
        public string SecondParentOrGuardianLocalTelephoneNumber
        {
            get
            {
                return this.secondParentOrGuardianLocalTelephoneNumber;
            }

            set
            {
                if (this.secondParentOrGuardianLocalTelephoneNumber != value)
                {
                    this.ValidateProperty("SecondParentOrGuardianLocalTelephoneNumber", value);
                    this.secondParentOrGuardianLocalTelephoneNumber = value;
                    this.RaisePropertyChanged("SecondParentOrGuardianLocalTelephoneNumber");
                }
            }
        }

        [Display(Name = "Patient location")]
        [Required]
        [RegularExpression(@"^(\d{2})-(\d{3})$")]
        public string PatientLocation
        {
            get
            {
                return this.patientLocation;
            }

            set
            {
                if (this.patientLocation != value)
                {
                    this.ValidateProperty("PatientLocation", value);
                    this.patientLocation = value;
                    this.RaisePropertyChanged("PatientLocation");
                }
            }
        }

        /// <summary>
        /// Gets and sets the first name.
        /// </summary>
        [Required]
        [Display(Name = "Primary physician: First name")]
        [StringLength(15)]
        public string PrimaryPhysicianFirstName
        {
            get
            {
                return this.primaryPhysicianFirstName;
            }

            set
            {
                if (this.primaryPhysicianFirstName != value)
                {
                    this.ValidateProperty("PrimaryPhysicianFirstName", value);
                    this.primaryPhysicianFirstName = value;
                    this.RaisePropertyChanged("PrimaryPhysicianFirstName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the middle initial.
        /// </summary>
        [Display(Name = "Primary physician: Middle initial")]
        [StringLength(1)]
        public string PrimaryPhysicianMiddleInitial
        {
            get
            {
                return this.primaryPhysicianMiddleInitial;
            }

            set
            {
                if (this.primaryPhysicianMiddleInitial != value)
                {
                    this.ValidateProperty("PrimaryPhysicianMiddleInitial", value);
                    this.primaryPhysicianMiddleInitial = value;
                    this.RaisePropertyChanged("PrimaryPhysicianMiddleInitial");
                }
            }
        }

        /// <summary>
        /// Gets and sets the last name.
        /// </summary>
        [Required]
        [Display(Name = "Primary physician: Last name")]
        [StringLength(15)]
        public string PrimaryPhysicianLastName
        {
            get
            {
                return this.primaryPhysicianLastName;
            }

            set
            {
                if (this.primaryPhysicianLastName != value)
                {
                    this.ValidateProperty("PrimaryPhysicianLastName", value);
                    this.primaryPhysicianLastName = value;
                    this.RaisePropertyChanged("PrimaryPhysicianLastName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Primary physician: Suffix")]
        [StringLength(5)]
        public string PrimaryPhysicianSuffix
        {
            get
            {
                return this.primaryPhysicianSuffix;
            }

            set
            {
                if (this.primaryPhysicianSuffix != value)
                {
                    this.ValidateProperty("PrimaryPhysicianSuffix", value);
                    this.primaryPhysicianSuffix = value;
                    this.RaisePropertyChanged("PrimaryPhysicianSuffix");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Primary physician: Hospital beeper number")]
        [Required]
        [RegularExpression(@"^(\d{4})$")]
        public string PrimaryPhysicianHospitalBeeperNumber
        {
            get
            {
                return this.primaryPhysicianHospitalBeeperNumber;
            }

            set
            {
                if (this.primaryPhysicianHospitalBeeperNumber != value)
                {
                    this.ValidateProperty("PrimaryPhysicianHospitalBeeperNumber", value);
                    this.primaryPhysicianHospitalBeeperNumber = value;
                    this.RaisePropertyChanged("PrimaryPhysicianHospitalBeeperNumber");
                }
            }
        }

        /// <summary>
        /// Gets and sets the first name.
        /// </summary>
        [Required]
        [Display(Name = "Primary nurse: First name")]
        [StringLength(15)]
        public string PrimaryNurseFirstName
        {
            get
            {
                return this.primaryNurseFirstName;
            }

            set
            {
                if (this.primaryNurseFirstName != value)
                {
                    this.ValidateProperty("PrimaryNurseFirstName", value);
                    this.primaryNurseFirstName = value;
                    this.RaisePropertyChanged("PrimaryNurseFirstName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the middle initial.
        /// </summary>
        [Display(Name = "Primary nurse: Middle initial")]
        [StringLength(1)]
        public string PrimaryNurseMiddleInitial
        {
            get
            {
                return this.primaryNurseMiddleInitial;
            }

            set
            {
                if (this.primaryNurseMiddleInitial != value)
                {
                    this.ValidateProperty("PrimaryNurseMiddleInitial", value);
                    this.primaryNurseMiddleInitial = value;
                    this.RaisePropertyChanged("PrimaryNurseMiddleInitial");
                }
            }
        }

        /// <summary>
        /// Gets and sets the last name.
        /// </summary>
        [Required]
        [Display(Name = "Primary nurse: Last name")]
        [StringLength(15)]
        public string PrimaryNurseLastName
        {
            get
            {
                return this.primaryNurseLastName;
            }

            set
            {
                if (this.primaryNurseLastName != value)
                {
                    this.ValidateProperty("PrimaryNurseLastName", value);
                    this.primaryNurseLastName = value;
                    this.RaisePropertyChanged("PrimaryNurseLastName");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Primary nurse: Suffix")]
        [StringLength(5)]
        public string PrimaryNurseSuffix
        {
            get
            {
                return this.primaryNurseSuffix;
            }

            set
            {
                if (this.primaryNurseSuffix != value)
                {
                    this.ValidateProperty("PrimaryNurseSuffix", value);
                    this.primaryNurseSuffix = value;
                    this.RaisePropertyChanged("PrimaryNurseSuffix");
                }
            }
        }

        /// <summary>
        /// Gets and sets the suffix.
        /// </summary>
        [Display(Name = "Primary nurse: Hospital beeper number")]
        [Required]
        [RegularExpression(@"^(\d{4})$")]
        public string PrimaryNurseHospitalBeeperNumber
        {
            get
            {
                return this.primaryNurseHospitalBeeperNumber;
            }

            set
            {
                if (this.primaryNurseHospitalBeeperNumber != value)
                {
                    this.ValidateProperty("PrimaryNurseHospitalBeeperNumber", value);
                    this.primaryNurseHospitalBeeperNumber = value;
                    this.RaisePropertyChanged("PrimaryNurseHospitalBeeperNumber");
                }
            }
        }

        /// <summary>
        /// Gets and sets the date admitted.
        /// </summary>
        [Required]
        [Display(Name="Date admitted")]
        public DateTime DateAdmitted
        {
            get
            {
                return this.dateAdmitted;
            }

            set
            {
                if (this.dateAdmitted != value)
                {
                    this.ValidateProperty("DateAdmitted", value);
                    this.dateAdmitted = value;
                    this.RaisePropertyChanged("DateAdmitted");
                }
            }
        }

        /// <summary>
        /// Gets and sets the date admitted.
        /// </summary>
        [Required]
        [Display(Name = "Date discharged", Description = "Use the maximum date if not yet discharged.")]
        public DateTime DateDischarged
        {
            get
            {
                return this.dateDischarged;
            }

            set
            {
                if (this.dateDischarged != value)
                {
                    this.ValidateProperty("DateDischarged", value);
                    this.dateDischarged = value;
                    this.RaisePropertyChanged("DateDischarged");
                }
            }
        }

        [Required]
        [Display(Name = "Do parent(s) or guardian(s) live within 500 miles of Broadlands Area Children's Hospital?")]
        public bool WithinMileLimit
        {
            get
            {
                return this.withinMileLimit;
            }

            set
            {
                if (this.withinMileLimit != value)
                {
                    this.ValidateProperty("WithinMileLimit", value);
                    this.withinMileLimit = value;
                    this.RaisePropertyChanged("WithinMileLimit");
                }
            }
        }

        [Required]
        [Display(Name = "Do parent(s) or guardian(s) apparently need JCF assistance?")]
        public bool JcfAssistance
        {
            get
            {
                return this.jcfAssistance;
            }

            set
            {
                if (this.jcfAssistance != value)
                {
                    this.ValidateProperty("JcfAssistance", value);
                    this.jcfAssistance = value;
                    this.RaisePropertyChanged("JcfAssistance");
                }
            }
        }

        [Required]
        [Display(Name = "Do parent(s) or guardian(s) apparently need WF assistance?")]
        public bool WfAssistance
        {
            get
            {
                return this.wfAssistance;
            }

            set
            {
                if (this.wfAssistance != value)
                {
                    this.ValidateProperty("WfAssistance", value);
                    this.wfAssistance = value;
                    this.RaisePropertyChanged("WfAssistance");
                }
            }
        }

        [Required]
        [Display(Name = "Do parent(s) or guardian(s) apparently need JC assistance?")]
        public bool JcAssistance
        {
            get
            {
                return this.jcAssistance;
            }

            set
            {
                if (this.jcAssistance != value)
                {
                    this.ValidateProperty("JcAssistance", value);
                    this.jcAssistance = value;
                    this.RaisePropertyChanged("JcAssistance");
                }
            }
        }
    }
}
